import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class RaisedButtonDemo extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => RaisedButtonState();
}

class RaisedButtonState extends State<RaisedButtonDemo> {
  int _counter = 0;

  void _initCount() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('RaisedButton凸起按钮组件'),
        centerTitle: true,
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            RaisedButton(
              child: Text(
                '点击登录按钮',
                style: TextStyle(fontSize: 26.0),
              ),
              //按钮背景颜色
              color: Colors.green,
              //按钮亮度主题，默认浅色主题
              colorBrightness: Brightness.dark,
              //按钮禁用时的背景颜色
              disabledColor: Colors.grey,
              //按钮禁用时的文字颜色
              disabledTextColor: Colors.grey[500],
              //按钮文字颜色
              textColor: Colors.white,
              // 按钮主题 ButtonTheme ButtonThemeData ButtonTextTheme ThemeData
              textTheme: ButtonTextTheme.normal,
              // 按钮按下时的背景颜色
              highlightColor: Colors.green[700],
              // 水波动画中水波的颜色
              splashColor: Colors.blue,
              // 抗锯齿能力
              clipBehavior: Clip.antiAlias,

              //内边距
              padding: EdgeInsets.only(
                  top: 5.0, bottom: 5.0, left: 20.0, right: 20.0),
              //边框圆角样式
              shape: RoundedRectangleBorder(
                  side: BorderSide(
                      width: 2.0,
                      color: Colors.deepPurple,
                      style: BorderStyle.solid),
                  borderRadius: BorderRadius.only(
                      topLeft: Radius.circular(10.0),
                      topRight: Radius.circular(10.0),
                      bottomLeft: Radius.circular(10.0),
                      bottomRight: Radius.circular(10.0))),
              //点击事件
              onPressed: () {
                print('按钮点击事件');
                _initCount();
              },
            ),
            Text(
              '点击按钮第$_counter次',
              style: TextStyle(fontSize: 40.0, color: Colors.deepPurple),
            )
          ],
        ),
      ),
    );
  }
}
